﻿namespace Example.Creational.Builder
{
    using System;
    using System.Collections.Generic;

    public sealed class ResultDirector
    {
        public ResultBuilder Builder { get; set; }

        public IResult Evaluate(IEnumerable<decimal> values)
        {
            foreach (var value in values)
            {
                if (0 > value)
                {
                    Builder.Subtract(Math.Abs(value));
                }
                else
                {
                    Builder.Add(value);
                }
            }

            return Builder.Result;
        }
    }
}